import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
import vuexPersist from "vuex-persist";

export default new Vuex.Store({
  state: {
    list: [],
    flag: 0,
  },
  mutations: {
    setlist(state, val) {
      state.list = val;
    },
    setindex(state, i) {
      state.flag = i;
    },
    removeall(state, result) {
      state.list = state.list.filter((item) => {
        return result.includes(item) == false;
      });
    },
  },
  actions: {},
  modules: {},
  plugins: [
    new vuexPersist({
      storage: window.localStorage,
    }).plugin,
  ],
  //插件 配置持久化插件
});
